﻿using System.Windows.Browser;
using ESRI.ArcGIS.Client.Geometry;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;

namespace DllShepherd.SilverlightGoogleMaps.ViewModel
{
    public class MainViewModel : ViewModelBase
    {
        public RelayCommand ViewStreetCommand { get; private set; }

        public MainViewModel()
        {
            ViewStreetCommand = new RelayCommand(ViewStreet);
            Config = MapApplicationConfigWrapper.Instance;
            MapMousePosition = new MapPoint();
        }
        private void ViewStreet()
        {
            HtmlPage.Window.Invoke("streetView", MapMousePosition.Y, MapMousePosition.X);
        }

        #region MVVM Properties

        private const string ConfigPropertyName = "Config";
        private MapApplicationConfigWrapper _config;

        public MapApplicationConfigWrapper Config
        {
            get { return _config; }
            set
            {
                _config = value;
                RaisePropertyChanged(ConfigPropertyName);
            }
        }

        private const string MapMousePositionPropertyName = "MapMousePosition";
        private MapPoint _mapMousePosition;

        public MapPoint MapMousePosition
        {
            get { return _mapMousePosition; }
            set
            {
                _mapMousePosition = value;
                RaisePropertyChanged(MapMousePositionPropertyName);
            }
        }

        #endregion
    }
}
